﻿using System;
using System.Collections.Generic;
using Color = System.Drawing.Color;
using SwinGame;

namespace Gundam_2._0_Alpha.src
{
    public class GameController
    {
        private Stack<Stage> gameStages = new Stack<Stage>();
        private Profile p = new Profile();

        public Profile P
        {
            get { return p; }
            set { p = value; }
        }

        public Stack<Stage> GameStages
        {
            get { return gameStages; }
            set { gameStages = value; }
        }

        public GameController()
        {
            Stage mainMenu = new Stage(false);
            Sprite tempSprite = Sprites.CreateSprite(Resources.LoadBitmap("mainButton.png"), 4, 10, 618, 48);
            int imagePosX = Core.ScreenWidth() /2 - tempSprite.Width /2,
                imagePosY = Core.ScreenHeight() /2 - tempSprite.Height /2;

            Button mainButton = new ImageButton(KeyCode.vk_RETURN, tempSprite, true, imagePosX, imagePosY);
            mainButton.ButtonAction = new CreateProfileMenu();
            mainMenu.ButtonList.Add(mainButton);
            gameStages.Push(mainMenu);
        }

        public void Update()
        {
            if(Input.KeyTyped(KeyCode.vk_F1)) Core.ToggleFullScreen();
            gameStages.Peek().Update(this);
            if (Input.KeyTyped(KeyCode.vk_ESCAPE))
                gameStages.Pop();
        }
        public void Draw()
        {
            gameStages.Peek().Draw();
        }
    }
}
